
public class MyBinaryTree<S> {
	private S elem;
	private MyBinaryTree<S> left;
	private MyBinaryTree<S> right;
	
	public<T> MyBinaryTree(MyBinaryTree<T> bt,Function<T,S> f){
		treeInject(bt,f);
	}
	
	private <T> MyBinaryTree<S> treeInject(MyBinaryTree<T> bt,Function<T,S> f){
		if(bt==null){
			return null;
		}
		
		MyBinaryTree<S> aux=new MyBinaryTree<S>(f.evaluate(bt.elem));
		aux.left=treeInject(bt.left,f);
		aux.right=treeInject(bt.right,f);
		return aux;
		
	}
	
	public MyBinaryTree(S elem){
		this.elem=elem;
		this.left=null;
		this.right=null;
	}
	
	private MyBinaryTree(S elem, MyBinaryTree<S> left, MyBinaryTree<S> right){
		this.elem=elem;
		this.left=left;
		this.right=right;
	}
	
	private <T> boolean mirrorsMe(MyBinaryTree<T> bt){
		boolean myVal=false;
		if((bt.left==null&&bt.right==null&&left==null&&right==null)){
			return true;
		}else if(bt.right!=null&&left!=null){
			myVal=bt.right.mirrorsMe(bt.left);
		}else if(bt.left!=null&&right!=null){
			myVal=myVal&&bt.left.mirrorsMe(bt.right);
		}
		return myVal;
	}
}
